<!DOCTYPE html>
<html>
<head>
	
	<title>编辑我的测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="/ui2/src/css/layui.css" media="all" />
<link rel="stylesheet" href="/ui2/css/public.css" media="all" />
<link rel="stylesheet" type="text/css" href="/ui/eova/css/eova.css">

<!--  <link rel="stylesheet" href="http://www.layui.com/admin/std/dist/layuiadmin/style/admin.css" media="all"> -->

<script type="text/javascript" src="/ui/js/jquery.min.js"></script>
<script type="text/javascript" src="/ui/js/json2-min.js"></script>

<script type="text/javascript" src="/ui/js/common.js"></script>
<script type="text/javascript" src="/ui/js/string.js"></script>

<script type="text/javascript" src="/ui2/src/layui.js"></script>
<script type="text/javascript" src="/ui2/js/DataTableExtend.js"></script>

<!-- <script type="text/javascript" src="http://yelog.org/layui-select-multiple/layui/layui.js"></script> -->

<!-- <script type="text/javascript" src="../../ui2/js/dataList.js"></script> -->





<script type="text/javascript" src="/plugins/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>



<script type="text/javascript" src="/plugins/format/jsformat.js"></script>

<script type="text/javascript" src="/ui/easy/easy.min.js"></script>
<script type="text/javascript" src="/ui/eova/eova.min.js"></script>
<script type="text/javascript" src="/ui/eova/src/eova.find.js"></script>



<script>
String.prototype.replaceAll  = function(s1,s2){     
    return this.replace(new RegExp(s1,"gm"),s2);     
} 
// 全局JS常量配置
var IMG = "${IMG!}";
var FILE = "${FILE!}";
var FILE_MAX = "${UPLOAD_FILE_SIZE!}";
var IMG_MAX = "${UPLOAD_IMG_SIZE!}";

//类似 .jpg|.gif|.png|.bmp
var UPLOAD_IMG_TYPE = "${UPLOAD_IMG_TYPE!}".replaceAll('\\.', '');
var UPLOAD_FILE_TYPE = "${UPLOAD_FILE_TYPE!}".replaceAll('\\.', '');
//刷新此页面
var refresh = function() {
	location.reload();
};

//页面类型 add/update/detail/examine
var PAGE_TYPE = "${PAGE_TYPE!}";

</script>
   <style>
        /* 下拉多选样式 需要引用*/
        select[multiple]+.layui-form-select dd{ padding:0;}
        select[multiple]+.layui-form-select .layui-form-checkbox[lay-skin=primary]{ margin:0 !important; display:block; line-height:36px !important; position:relative; padding-left:26px;}
        select[multiple]+.layui-form-select .layui-form-checkbox[lay-skin=primary] span{line-height:36px !important; float:none;}
        select[multiple]+.layui-form-select .layui-form-checkbox[lay-skin=primary] i{ position:absolute; left:10px; top:0; margin-top:9px;}
        .multiSelect{ line-height:normal; height:auto; padding:4px 10px; overflow:hidden;min-height:38px; margin-top:-38px; left:0; z-index:99;position:relative;background:none;}
        .multiSelect a{ padding:2px 5px; background:#908e8e; border-radius:2px; color:#fff; display:block; line-height:20px; height:20px; margin:2px 5px 2px 0; float:left;}
        .multiSelect a span{ float:left;}
        .multiSelect a i{ float:left; display:block; margin:2px 0 0 2px; border-radius:2px; width:8px; height:8px; background:url(/ui2/images/close.png) no-repeat center; background-size:65%; padding:4px;}
        .multiSelect a i:hover{ background-color:#545556;}
/* table 自适应 横向滚动条 */
body{overflow-y: scroll;}
.layui-card-header {
    position: relative;
        height: 32px;
    line-height: 32px;
}

h1{
            font-family: "微软雅黑";
            font-weight: normal;
        }
        .btn {
            display: inline-block;
            *display: inline;
            padding: 4px 12px;
            margin-bottom: 0;
            *margin-left: .3em;
            font-size: 14px;
            line-height: 20px;
            color: #333333;
            text-align: center;
            text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
            vertical-align: middle;
            cursor: pointer;
            background-color: #f5f5f5;
            *background-color: #e6e6e6;
            background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
            background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
            background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
            background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
            background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
            background-repeat: repeat-x;
            border: 1px solid #cccccc;
            *border: 0;
            border-color: #e6e6e6 #e6e6e6 #bfbfbf;
            border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
            border-bottom-color: #b3b3b3;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            border-radius: 4px;
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
            filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
            *zoom: 1;
            -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
            -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        .btn:hover,
        .btn:focus,
        .btn:active,
        .btn.active,
        .btn.disabled,
        .btn[disabled] {
            color: #333333;
            background-color: #e6e6e6;
            *background-color: #d9d9d9;
        }

        .btn:active,
        .btn.active {
            background-color: #cccccc \9;
        }

        .btn:first-child {
            *margin-left: 0;
        }

        .btn:hover,
        .btn:focus {
            color: #333333;
            text-decoration: none;
            background-position: 0 -15px;
            -webkit-transition: background-position 0.1s linear;
            -moz-transition: background-position 0.1s linear;
            -o-transition: background-position 0.1s linear;
            transition: background-position 0.1s linear;
        }

        .btn:focus {
            outline: thin dotted #333;
            outline: 5px auto -webkit-focus-ring-color;
            outline-offset: -2px;
        }

        .btn.active,
        .btn:active {
            background-image: none;
            outline: 0;
            -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
            -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        .btn.disabled,
        .btn[disabled] {
            cursor: default;
            background-image: none;
            opacity: 0.65;
            filter: alpha(opacity=65);
            -webkit-box-shadow: none;
            -moz-box-shadow: none;
            box-shadow: none;
        }
    </style>
</head>

 <link rel="stylesheet" href="http://www.layui.com/admin/std/dist/layuiadmin/style/admin.css" media="all">
      <link href="/plugins/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
   <script type="text/javascript" charset="utf-8" src="/plugins/umeditor/umeditor.config.js"></script>
  <script type="text/javascript" charset="utf-8" src="/plugins/umeditor/umeditor.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
  <script type="text/javascript" charset="utf-8" src="/plugins/umeditor/lang/zh-cn/zh-cn.js"></script>
<body>
<form id="updateFormdemo2_test" name="updateFormdemo2_test" method="post"  class="layui-form">
<div class="layui-fluid">
   <div class="layui-row layui-col-space15">
     <div class="layui-col-md12">

<div class="layui-card">
<div class="layui-card-header">面板111</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space10 layui-form-item">
								<div class="layui-col-lg3">
								<label class="layui-form-label" title="姓名[name]">
								姓名</label>
									<div class="layui-input-block" >
<input type="text" id="name" name="name" value="${@record.get('name')}" placeholder=""  lay-verify="length[2~5]" autocomplete="off" class="layui-input">				                    </div>
				                </div>
								<div class="layui-col-lg3">
								<label class="layui-form-label" title="喜好1[tag1]">
<font size="4" face="arial" color="red">*</font>								喜好1</label>
									<div class="layui-input-block" >
<select  id="tag1" name="tag1" lay-filter="tag1" url="/widget/comboJson/demo2_test-tag1" lay-verify="required"    multiple lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var tag1_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#tag1").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="tag1"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //tag1_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-tag1',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="tag1"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#tag1").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#tag1").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#tag1").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('tag1')}' != '')
			    	$('select[id="tag1"]').val('${@record.get('tag1')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	tag1_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(tag1)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="tag1"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //tag1_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>				                    </div>
				                </div>
								<div class="layui-col-lg3">
								<label class="layui-form-label" title="喜好2[tag2]">
<font size="4" face="arial" color="red">*</font>								喜好2</label>
									<div class="layui-input-block" >
<select  id="tag2" name="tag2" lay-filter="tag2" url="/widget/comboJson/demo2_test-tag2" lay-verify="required"     lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var tag2_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#tag2").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="tag2"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //tag2_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-tag2',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="tag2"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#tag2").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#tag2").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#tag2").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('tag2')}' != '')
			    	$('select[id="tag2"]').val('${@record.get('tag2')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	tag2_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(tag2)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="tag2"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //tag2_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>				                    </div>
				                </div>
								<div class="layui-col-lg3">
								<label class="layui-form-label" title="ID[id]">
<font size="4" face="arial" color="red">*</font>								ID</label>
									<div class="layui-input-block" >
<input type="text" id="id" name="id" value="${@record.get('id')}" placeholder="" readonly lay-verify="required" autocomplete="off" class="layui-input">				                    </div>
				                </div>
</div>
<div class="layui-row layui-col-space10 layui-form-item">
								<div class="layui-col-lg6">
								<label class="layui-form-label" title="密码[password]">
<font size="4" face="arial" color="red">*</font>								密码</label>
									<div class="layui-input-block" >
<input type="password" id="password" name="password" value="${@record.get('password')}" lay-verify="required|length[6~10]" placeholder="请输入密码" autocomplete="off" class="layui-input">				                    </div>
				                </div>
								<div class="layui-col-lg6">
								<label class="layui-form-label" title="产品[relation_pro]">
<font size="4" face="arial" color="red">*</font>								产品</label>
									<div class="layui-input-block" >

<div class="layui-input">
     <input type="text" id="relation_pro_show" name="relation_pro_show"  placeholder="请选择"     class="tags-input">
	 <input type="hidden" id="relation_pro" name="relation_pro" value="${@record.get('relation_pro')}" lay-verify="required" title='产品'  >
</div>

<script type="text/javascript">
$(function () {

	
	
	
var initrelation_proData = function() {	
	// 手动赋值,如果有值的花
 	$.ajax({
		url : ''+"/widget/findCnByEn/demo2_test-relation_pro-${@record.get('relation_pro')}",
		type : 'get',
		success : function(data) {
			
			var objShow = $('#relation_pro_show');
			var obj = $('#relation_pro');
			
			var object = eval(data);
			var text_field_name = object.text_field;
			var text_field_id = null;
			var objects = eval(object.data);
	
			
			for(var key in objects[0]){ 
				if(key !=text_field_name){
					text_field_id = key;
					break;
				}
			}
			
			
			for(j = 0,len=objects.length; j < len; j++) {
				var one = objects[j];
				if(j == 0)
					addTag(objShow,obj,one[text_field_id],one[text_field_name],true);
				else
					addTag(objShow,obj,one[text_field_id],one[text_field_name],false);
			}
			
			
		}
	});
}
if('${@record.get('relation_pro')}' != ''){
	initrelation_proData();
}
	
		 //如果是只读模式，则事件移除
 		 //tag移除事件
 	 	 $(document).on('click','.relation_pro',function(obj){
 	 	      // console.log(obj.target.parentNode);//标准 
 	 	      
 	 	      if($("#relation_pro_show").attr('readonly') != "readonly")
 	 	        removeTag(obj.target);
 	 	   });
 	 	 //点击事件
 	 	 $("#relation_pro_show").click(function(){
 	 		 if($("#relation_pro_show").attr('readonly') != "readonly")
 	 			tagchoice($('#relation_pro_show'),$('#relation_pro'),'/widget/find?code=demo2_test&field=relation_pro&template=lay',false);
 	 	  });



});	    
</script>
				                    </div>
				                </div>
</div>
			
			
			
			</div>
			</div>
			
<div class="layui-card">
<div class="layui-card-header">面板2</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space10 layui-form-item">
								<div class="layui-col-lg12">
								<label class="layui-form-label" title="是否有效[status]">
								是否有效</label>
									<div class="layui-input-block" >
<input type="checkbox"  id="status" name="status" lay-skin="switch" lay-text="是|否"  >
				                    </div>
				                </div>
</div>
<div class="layui-row layui-col-space10 layui-form-item">
								<div class="layui-col-lg6">
								<label class="layui-form-label" title="头像[avatar]">
<font size="4" face="arial" color="red">*</font>								头像</label>
									<div class="layui-input-block" >


<div class="layui-upload">
  <button type="button" class="layui-btn" id="avatar_button" name="avatar_button" >上传图片</button>
  <div class="layui-upload-list">
  	<input type="hidden"  id="avatar" name="avatar" value="${@record.get('avatar')}" lay-verify="required" title='头像'/>
    <img class="layui-upload-img" id="avatar_img" src="http://127.0.0.1:8080/file/${@record.get('avatar')}" >
    <p id="avatar_text"></p>
  </div>
</div>  


<script>

$('#avatar_img').attr('style', 'height: 100px;max-width: 360px;'); 


layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;
	  

	  //普通图片上传
	  var uploadInst_avatar = upload.render({
	    elem: '#avatar_button'
	    ,url: '/upload/img?name=avatar_file&filedir='
	    ,size: IMG_MAX //限制文件大小，单位 KB
	    ,accept:'file'
	    ,exts:UPLOAD_IMG_TYPE
	    ,acceptMime: 'image/*' //（只显示图片文件） 2.2.6 开始新增
	    ,field:'avatar_file'
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	    	$('#avatar_img').attr('style', 'height: 100px;max-width: 360px;'); 
	        $('#avatar_img').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(res.success == false){
	        return layer.msg('上传失败');
	      }
	      //上传成功
	      $('#avatar').attr('value', res.fileName); 
	    }
	    ,error: function(){
	      //演示失败状态，并实现重传
	      var demoText = $('#avatar_text');
	      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini img-reload_avatar">重试</a>');
	      demoText.find('.img-reload_avatar').on('click', function(){
	        uploadInst_avatar.upload();
	      });
	    }
	  });
});


$(function() {
	var $input = $('#avatar');
	
	var htmlOptions = eval('({})');
	if (htmlOptions.isReadonly) {
        $input.parent().mask();
        return;
    }
	
	// init input file
	$('.eova-file').each(function() {
		var offset = $(this).find('input[type=text]').offset();
		$(this).find('input[type=file]').css({
			left : offset.left-1,
			// top : offset.top-1,
			width : $(this).width()
		});
	});
	
	// 异步传图(动态绑定事件)
	var myfun = function(){
		
		var $this_file = $("#avatar_file");
		console.log($this_file.val());
		$input.val($this_file.val());
		var reader = new FileReader();
		var files = $this_file.prop('files');
		reader.readAsDataURL(files[0]);
		reader.onload = function(e) {
			$this_file.parent().find('img').attr('src', e.target.result);
		}
	
		$input.val("Loading...");
		
		$('#avatar_file').upload({
			action: '/upload/img?name=avatar_file&filedir=',
			name: "avatar_file",
			onsuccess: function(json) {
				$input.val(json.fileName);
			}
		});
	};
	
	$(document).on("change","#avatar_file", myfun);
	
});
</script>				                    </div>
				                </div>
								<div class="layui-col-lg6">
								<label class="layui-form-label" title="附件[file]">
<font size="4" face="arial" color="red">*</font>								附件</label>
									<div class="layui-input-block" >
<div class="layui-upload">
  <button type="button" class="layui-btn" id="file_button" name="file_button" >选择文件</button>
  <div class="layui-upload-list">
  	<input type="hidden"  id="file" name="file" title='附件' lay-verify="required" value="${@record.get('file')}" />
    <p id="file_text"></p>
  </div>
</div>  

<script>
// 目前只支持单文件

layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;
	  
	  //初始
	  showFile_file('${@record.get('file')}','${@record.get('file')}');
	  
	  //普通文件上传
	  var uploadInst_file = upload.render({
	    elem: '#file_button'
	    ,url: '/upload/file?name=file_file&filedir='
	    ,size: FILE_MAX //限制文件大小，单位 KB
	    ,accept:'file'
	    ,exts:UPLOAD_FILE_TYPE
	    ,field:'file_file'
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	    	  var demoText = $('#file_text');
	    	  demoText.html('<span class="layui-inline layui-upload-choose">'+file.name+'</span>');
	      });
	    } 
	    
	 
	    //,multiple: true
	   // ,bindAction: '#file_button_begin'
	    ,done: function(res){
	      //如果文件上传失败
	      if(res.success == false){
	    	  $('#file').attr('value', ""); 
	        return layer.msg('上传失败:'+res.msg);
	      }
	      //上传成功
	      $('#file').attr('value', res.fileName); 
	      
	      var demoText = $('#file_text');
	      var fileName = demoText.text();
	      
	      showFile_file(res.fileName,fileName);
	    }
	    ,error: function(){
	      //演示失败状态，并实现重传
	      var demoText = $('#file_text');
	      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini file-reload_file">重试</a>');
	      demoText.find('.file-reload_file').on('click', function(){
	        uploadInst_file.upload();
	      });
	    }
	  });
});

//path 为局部地址如：/upload/aaa.jpg,name=/upload/aaa.jpg或者 aaa.jpg即可
function showFile_file(path,name){
	  var demoText = $('#file_text');
	  var url = '';
	  if(path != ''){
		  if(path.indexOf("http://") == -1){
			  
			  url = 'http://127.0.0.1:8080/file'+'/' +path;
		  }else
			  url = path;
	  }
	  

	  
	  //文件名需要 ‘/111/a.jpg’=》裁剪成 a.jpg （如果出现的话）
	  var index = name.lastIndexOf('/');
	  if(index != -1)
		  name = name.substring(index+1);
	  
      demoText.html('<a href="'+url+'" target="view_window"><span class="layui-inline layui-upload-choose">'+name+'</span></a>');
}

</script>				                    </div>
				                </div>
</div>
<div class="layui-row layui-col-space10 layui-form-item">
								<div class="layui-col-lg4">
								<label class="layui-form-label" title="省[p_id]">
								省</label>
									<div class="layui-input-block" >
<select  id="p_id" name="p_id" lay-filter="p_id" url="/widget/comboJson/demo2_test-p_id" lay-verify=""     lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var p_id_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#p_id").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="p_id"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //p_id_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-p_id',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="p_id"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#p_id").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#p_id").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#p_id").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('p_id')}' != '')
			    	$('select[id="p_id"]').val('${@record.get('p_id')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	p_id_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(p_id)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="p_id"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //p_id_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>				                    </div>
				                </div>
								<div class="layui-col-lg4">
								<label class="layui-form-label" title="市[c_id]">
								市</label>
									<div class="layui-input-block" >
<select  id="c_id" name="c_id" lay-filter="c_id" url="/widget/comboJson/demo2_test-c_id" lay-verify=""     lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var c_id_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#c_id").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="c_id"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //c_id_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-c_id',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="c_id"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#c_id").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#c_id").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#c_id").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('c_id')}' != '')
			    	$('select[id="c_id"]').val('${@record.get('c_id')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	c_id_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(c_id)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="c_id"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //c_id_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>				                    </div>
				                </div>
								<div class="layui-col-lg4">
								<label class="layui-form-label" title="区[a_id]">
								区</label>
									<div class="layui-input-block" >
<select  id="a_id" name="a_id" lay-filter="a_id" url="/widget/comboJson/demo2_test-a_id" lay-verify=""     lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var a_id_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#a_id").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="a_id"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //a_id_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-a_id',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="a_id"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#a_id").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#a_id").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#a_id").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('a_id')}' != '')
			    	$('select[id="a_id"]').val('${@record.get('a_id')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	a_id_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(a_id)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="a_id"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //a_id_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>				                    </div>
				                </div>
</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">性别</label>
										<div class="layui-input-block">
<select  id="sexy" name="sexy" lay-filter="sexy" url="/widget/comboJson/demo2_test-sexy" lay-verify=""     lay-search >
<!--         <option value="">请选择</option> -->
       
<!--         <option value="0">写作</option> -->
<!--         <option value="1" >阅读</option> -->
<!--         <option value="2">游戏</option> -->
<!--         <option value="3">音乐</option> -->
<!--         <option value="4">旅行</option> -->
        
      </select>
<script type="text/javascript">
var sexy_init= function(){
	//清除本节点数据（子节点也要执行初始）
	$("#sexy").empty();
	//检查是否有子节点需要刷新数据
	  var pid = $('select[pid="sexy"]');
	  if(pid.length != 0){
		  //关联初始
		  var funName = pid.attr("id")+"_init";
		  //sexy_init
		  if(isExitsFunction(funName) ){
			  //funName();
			  //alert(funName);
    	  		//dataDone(res, curr, count,is_single);
			  eval(funName+"();");

    	  	}
	  }
	
	// 手动赋值(可能存在级联关系)
 	$.ajax({
		url : '/widget/comboJson/demo2_test-sexy',
		type : 'get',
		success : function(data) {
			
			var objects = eval(data);
			var pidKey = null;
			var pidValue = null;
			//判断是否有
			//select areaId ID,areaName CN,parentid p_id from table//如果存在ID，CN之外的字段则认为是关联的,并且指定了父节点是谁
			if(objects.length>=2){//
				var object = objects[1];
				for ( i in object)
				{
					//console.log(i);
					if(i != 'id' && i != 'cn'){
						pidKey = i;
						break;
					}
				}
			}
			
			if(pidKey != null){
				 //如果存在 
				$('select[id="sexy"]').attr("pid",pidKey);
				pidValue = $('select[id="'+pidKey+'"]').val();
			}
			//检测父节点是否有值才渲染|| 无父节点也渲染
			console.log('pidValue:'+pidValue);
			if(pidKey == null
					|| (pidValue != null && pidValue!= '')){
				
				
				$(objects).each(
						function(index) {
							if(index == 0){							
								$("#sexy").append('<option value="">请选择</option>');
							}
							
							var object = objects[index];
							if(pidKey == null){
								var optionStr = "";
								optionStr += "<option value='" + object.id + "'>"
										+ object.cn + "</option>";
								$("#sexy").append(optionStr);
							}else{
								 if(object[pidKey] == pidValue){
									var optionStr = "";
									optionStr += "<option value='" + object.id + "'>"
											+ object.cn + "</option>";
									$("#sexy").append(optionStr);
								}
							}
						});
				
				
				if('${@record.get('sexy')}' != '')
			    	$('select[id="sexy"]').val('${@record.get('sexy')}'.split(','));
				
			}
			renderForm();//由于前部还有一个重置options的操作
		}
	});
}	
	sexy_init();
 	layui.use(['form'], function(){
 		var form = layui.form;
 		//选中事件
		form.on('select(sexy)', function(data){
			  console.log(data);
			  //检查是否有子节点需要刷新数据
			  var pid = $('select[pid="sexy"]');
			  if(pid.length != 0){
				  //关联初始
				  var funName = pid.attr("id")+"_init";
				  //sexy_init
				  if(isExitsFunction(funName) ){
					  //funName();
					  //alert(funName);
	          	  		//dataDone(res, curr, count,is_single);
					  eval(funName+"();");

	          	  	}
			  }
			  
			});
 	});
</script>					                    </div>
					                </div>
								</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">手机号</label>
										<div class="layui-input-block">
<input type="text" id="mobile" name="mobile" value="${@record.get('mobile')}" placeholder=""  lay-verify="" autocomplete="off" class="layui-input">					                    </div>
					                </div>
								</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">备注</label>
										<div class="layui-input-block">
<textarea class="layui-textarea" id="remark" name="remark" style="width:98%;height:20px;"  placeholder=""  lay-verify="length[10~]"  >${@record.get('remark')}</textarea>

					                    </div>
					                </div>
								</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">创建时间</label>
										<div class="layui-input-block">
	
<input type="text" class="layui-input" lay-verify="required" id="create_time" name="create_time" readonly value="${strutil.formatDate(@record.get('create_time'), 'yyyy-MM-dd HH:mm:ss')}" placeholder="yyyy-MM-dd HH:mm:ss">
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
});
</script>					                    </div>
					                </div>
								</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">修改时间</label>
										<div class="layui-input-block">
	
<input type="text" class="layui-input" lay-verify="required" id="update_time" name="update_time" readonly value="${strutil.formatDate(@record.get('update_time'), 'yyyy-MM-dd HH:mm:ss')}" placeholder="yyyy-MM-dd HH:mm:ss">
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
});
</script>					                    </div>
					                </div>
								</div>
								<div class="layui-row layui-col-space10 layui-form-item">
									<div class="layui-col-lg12}">
									<label class="layui-form-label">审核状态</label>
										<div class="layui-input-block">
<!-- 审核模块需要用到 -->
<div id="mycheck_shenhe_status">
      <input type="hidden" name="shenhe_status" value="${@record.get('shenhe_status')}">

       <!-- <input type="radio" name="sex" value="男" title="男" checked="">
      <input type="radio" name="sex" value="女" title="女">
      <input type="radio" name="sex" value="禁" title="禁用" disabled="">  -->

</div>
<script>
// JS 可以干预控件所在页面的任何效果


$(function(){

	var idName = "mycheck_shenhe_status";
	var $checks = $('#' + idName);
	var $checkValue = $checks.find("input:hidden");
	
	var readonly = false;
	
	// 加载数据(复选框其实和下拉一样，只是展现方式不一样，所以直接用下拉的API获取数据)
	var url = "/widget/comboJson/demo2_test-shenhe_status";
	$.ajax({
        type: 'get',
        async: true,
        url: url,
        dataType: "json",
        success: function (json) {
        	
        	// 生成复选框Dom
            $.each(json, function (index, o) {
            	$('<input type="radio" name="shenhe_status_radio" lay-filter="shenhe_status_radio" value="'+o.id+'" title="'+o.cn+'" >').appendTo($checks);
                //$("<label><input type=\"radio\" value=\"" + o.id + "\">" + o.cn + "&nbsp;</label>").appendTo($checks);
            });
        	// 初始化选中
        	var vals = $checkValue.val().split(",");
        	
        	$checks.find('input:radio').each(function(i, o){
        		console.log($(o).val());
        		
        		if(readonly){
        			o.disabled = true;
        		}
        		
        		
        		if($checkValue.val() == $(o).val()){
        			o.checked = true;
        			//审核界面才需此效果
        			if(PAGE_TYPE == "examine")
    					o.disabled = true;
        			
        		}
        		
        	});
        	
           
         // 绑定radio事件
            layui.use(['form'], function(){
            	var form = layui.form;
            	form.on('radio(shenhe_status_radio)', function(data){
              	  //console.log(data.elem); //得到radio原始DOM对象
              	  //console.log(data.value); //被点击的radio的value值
              		$checkValue.val(data.value);
              	}); 
            });
            
            renderForm();
             
        },
        error: function () {
            alert('复选框加载数据失败,URL=' + url);
        }
    });



});
</script>
					                    </div>
					                </div>
								</div>
					
			 <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit="" lay-filter="submit">
			    	  立即提交
			      </button>
                </div>
             </div>
			
			
			
			</div>
			</div>
			
<input type="hidden" name="user_id" value="${@record.get('user_id')}" />


		
<!-- 		<div class="layui-form-item"> -->
<!--                 <div class="layui-input-block"> -->
<!--                   <button class="layui-btn" lay-submit lay-filter="component-form-element">立即提交</button> -->
<!--                   <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
<!--                 </div> -->
<!--         </div> -->

 	</div>
  </div>
</div>
</form>
<script>


layui.use(['form','code'], function(){
	  var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
	   $ = layui.$;
	   
       // 代码块
       layui.code({
           title: 'html',
           encode: true,
           about: false

       });
	
       // 手动赋值
       //$('select[name="简化多选+搜索+大小写敏感"]').val(['sing1', 'movie2']);
       form.render();
	  
	  //但是，如果你的HTML是动态生成的，自动渲染就会失效
	  //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
       form.on('submit(submit)', function(data){
    		  //console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
    		  //console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
    		  //console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
    		  //console.log(syntaxHighlight(data.field));
    		  
    		  //提交数据
    		  submitNow(data);
    		  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    		});
	  
	}); 

// json 格式化+高亮
function syntaxHighlight(json) {
    if (typeof json != 'string') {
        json = JSON.stringify(json, undefined, 2);
    }
    json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
    return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
        var cls = 'number';
        if (/^"/.test(match)) {
            if (/:$/.test(match)) {
                cls = 'key';
            } else {
                cls = 'string';
            }
        } else if (/true|false/.test(match)) {
            cls = 'boolean';
        } else if (/null/.test(match)) {
            cls = 'null';
        }
        return '<span class="' + cls + '">' + match + '</span>';
    });
}
</script>

<script type="text/javascript">
var $form = $('#updateFormdemo2_test');

var submitNow = function(data) {
	
	var myform = $.getFormParasObj($form);
	myform['PAGE_TYPE'] = PAGE_TYPE;
	
	$.post('/form/doUpdate/demo2_test', myform, function(result) {
		if (result.success) {
			
			var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			parent.layer.close(index);
			
			parent.reload();
		} else {
			//$.alert($pjq, result.msg);
			layer.alert(result.msg, {icon: 2});
		}
	}, 'json');
};



</script>
</body>



</html>